Repository navigation
[Configuration] Ignore unsupported OTEL_PROPAGATORS values with a warning - #9515
MilanGarnier wants to merge 4 commits into
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aafd374409
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
BenchmarksBenchmark execution time: 2026-10-30 16:16:42 Comparing candidate commit 8015de1 in PR branch Found 3 performance improvements and 0 performance regressions! Performance is the same for 69 metrics, 0 unstable metrics, 8 known flaky benchmarks, 117 flaky benchmarks without significant changes.
|
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (9515) and master. ✅ No regressions detected |
There was a problem hiding this comment.
With the default composite configuration source, OTEL_PROPAGATORS=jaeger falls back to defaults but emits neither the promised warning nor the OpenTelemetryConfigInvalid metric.
🤖 Bits Code Review · Commit 15bfd58
| .WithKeys(ConfigurationKeys.OpenTelemetry.Propagators) | ||
| .GetAsClassResult( | ||
| validator: injectionValidator, // invalid individual values are rejected later | ||
| validator: styles => styles.Any(IsSupportedOtelPropagator), |
There was a problem hiding this comment.
Preserve invalid propagators through composite source resolution
With the default composite configuration source and only OTEL_PROPAGATORS=jaeger configured, this validator rejects the value. CompositeConfigurationSource.GetAs discards invalid results and returns NotFound when no source validates, so the new IsPresent branch never emits the promised warning or OpenTelemetryConfigInvalid metric. Propagation falls back to defaults silently. Preserve invalid presence when no source validates while retaining fallback to valid lower-priority sources, and cover the unsupported-only composite case. This requires changes beyond a localized replacement in this diff.
React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it
What each reaction means
- 👍 Useful: correct, and you're fixing it or will.
- 👎 Wrong: the finding is incorrect, for example the bug can't happen or the code was misread.
- 😕 Unclear: you can't tell what it means or why it matters.
- 👀 Right, not acting: correct, but intended, out of scope for this PR, a known risk, or too minor.
🤖 Bits Code Review · Open Bits AI session
There was a problem hiding this comment.
This issue seems to be gue to composite config, fix proposed in #9522
| else if (otelValue is "," or "jaeger") | ||
| { | ||
| yield return (Count.OpenTelemetryConfigInvalid, otelSetting, ddSetting); | ||
| } | ||
|
|
||
| // Values mixing supported and unsupported propagators | ||
| if (otelValue is "tracecontext,baggage,jaeger,xray" or "b3,ottrace" or "tracecontext,jaeger") | ||
| { | ||
| yield return (Count.OpenTelemetryConfigInvalid, otelSetting, ddSetting); | ||
| } |
There was a problem hiding this comment.
This algorithm is too specific and breaks when different inputs are passed in. This should be input-agnostic, similar to what is done in TracerSettings. I think it would look something like this:
| else if (otelValue is "," or "jaeger") | |
| { | |
| yield return (Count.OpenTelemetryConfigInvalid, otelSetting, ddSetting); | |
| } | |
| // Values mixing supported and unsupported propagators | |
| if (otelValue is "tracecontext,baggage,jaeger,xray" or "b3,ottrace" or "tracecontext,jaeger") | |
| { | |
| yield return (Count.OpenTelemetryConfigInvalid, otelSetting, ddSetting); | |
| } | |
| if (otelValue is not null && otelValue.Split(',').Where(s => !IsSupportedOtelPropagator(s.Trim())).Any()) | |
| { | |
| // Emit warnings when any unsupported propagator is included | |
| yield return (Count.OpenTelemetryConfigInvalid, otelSetting, ddSetting); | |
| } | |
| bool IsSupportedOtelPropagator(string propagator) | |
| => SpanContextPropagatorFactory.GetPropagator(propagator) is not null | |
| || string.Equals(propagator, "none", StringComparison.OrdinalIgnoreCase); |
| converter: otelConverter); | ||
|
|
||
| // Filter the selected value, rather than in the converter, which runs once per source | ||
| if (otelPropagation.ConfigurationResult is { Result: { } otelPropagators, IsValid: true }) |
There was a problem hiding this comment.
I asked Codex to help refactor this so it's more maintainable, and I like the suggestion to refactor this bit of code into a private static method, then that can simply be called inline with the otelPropagation call above:
// Caller
var otelPropagation = NormalizeOtelPropagators(
config.WithKeys(ConfigurationKeys.OpenTelemetry.Propagators)
.GetAsClassResult(
validator: styles => styles.Any(IsSupportedOtelPropagator),
converter: otelConverter),
ErrorLog)
// Refactored helper method
private static ConfigurationBuilder.ClassConfigurationResultWithKey<string[]>
NormalizeOtelPropagators(
in ConfigurationBuilder.ClassConfigurationResultWithKey<string[]> original,
OverrideErrorLog errorLog)
{
var result = original.ConfigurationResult;
if (result is { IsValid: true, Result: { } styles })
{
var unsupported = styles.Where(s => !IsSupportedOtelPropagator(s)).ToArray();
if (unsupported.Length == 0)
{
return original;
}
errorLog.LogUnsupportedValues(original.Key, unsupported);
result = ConfigurationResult<string[]>.Valid(
styles.Where(IsSupportedOtelPropagator).ToArray(),
result.TelemetryOverride);
}
else if (result.IsPresent)
{
errorLog.LogInvalidConfiguration(original.Key);
result = ConfigurationResult<string[]>.NotFound();
}
else
{
return original;
}
return new(original.Telemetry, original.Key, original.RecordValue, result);
zacharycmontoya
left a comment
There was a problem hiding this comment.
Changes look good, but please consider my suggestions so the implementation & tests are more maintainable 🙏🏼
Extract selected-source normalization and generalize propagation telemetry test expectations. Cover unsupported-only values through composite configuration; that regression depends on #9522.
| yield return (Count.OpenTelemetryConfigHiddenByDatadogConfig, otelSetting, ddSetting); | ||
| } | ||
|
|
||
| if (!hasSupportedPropagator || propagators.Any(s => !IsSupportedOtelPropagator(s))) |
There was a problem hiding this comment.
Small suggestion that I think makes this a little more clear
| if (!hasSupportedPropagator || propagators.Any(s => !IsSupportedOtelPropagator(s))) | |
| if (propagators.Length == 0 || !propagators.All(IsSupportedOtelPropagator) |
Summary of changes
Unsupported/invalid values in
OTEL_PROPAGATORS(e.g.jaeger,ottrace,xray,typos) are now dropped with a warning that names them. If no supported value
remains, the default propagators are used, as when the variable is unset.
Reason for change
Today invalid/unsupported propagators are accepted silently: a mixed config like
tracecontext,baggage,jaegerlosesjaegerwithout any log, and a config madeonly of unsupported values (
OTEL_PROPAGATORS=jaeger) leaves the tracer with noinjectors or extractors, so propagation is silently disabled. Logging a warning + falling back if no valid propagators are left should make onboarding OTel customers easier.
(+theoretically, OTel spec requires unrecognized propagators to be ignored with a warning).
Jira: APMAPI-2623
Implementation details
OTEL_PROPAGATORSvalidator inTracerSettingsnow requires at least onesupported propagator (one
SpanContextPropagatorFactorycan create, ornone). Otherwise the existing override path applies the defaults, logs theinvalid-configuration warning and records
OpenTelemetryConfigInvalid.resolution, not in the converter, which runs once per source and would
report values from unused sources.
OverrideErrorLog.LogUnsupportedValuesqueues the warning and recordsOpenTelemetryConfigInvalid. It also runs whenDD_TRACE_PROPAGATION_STYLE*hides
OTEL_PROPAGATORS.Test coverage
TracerSettingsTests: new cases forPropagationStyleInject/PropagationStyleExtract, plus warning tests for unsupported values andfor source selection.
Test_OTEL_PROPAGATORS::test_invalid_{is_ignored|value_logs_warning}now pass